const { DataTypes } = require('sequelize')
const seq = require('../db/seq')

const ActivityLocation = seq.define('zhku_activities_loaction', {
    act_id: {
        type: DataTypes.STRING(36),
        allowNull: false,
        comment: '活动编号（唯一）'
    },
    latitude: {
        type: DataTypes.FLOAT(11),
        allowNull: true,
        defaultValue: 0,
        comment: '纬度'
    },
    longitude: {
        type: DataTypes.FLOAT(11),
        allowNull: true,
        defaultValue: 0,
        comment: '经度'
    },
    address: {
        type: DataTypes.STRING(36),
        allowNull: true,
        comment: '详细地址'
    },
    name: {
        type: DataTypes.STRING(36),
        allowNull: true,
        comment: '位置名称'
    }
}, {
    tableName: 'zhku_activities_loaction', // 表名
    timestamps: false, // 是否创建时间戳列
    freezeTableName: true // 强制表名等于模型名
})

// 如果数据库不存在该表，则自动创建
// ActivityLocation.sync()

module.exports = ActivityLocation